print("-" * 10, '结构模型匹配', "-" * 10)
data = eval(input("请输入需要匹配的数据："))
match data:
    case {'name': 'madidi', 'age': 18}:
        print('字典')
    case [10, 20, 30]:
        print('列表')
    case (10, 20, 30):
        print('元组')
    case set([10, 20, 30]):
        print('集合')
    case _:
        print('索引的类型匹配失败')

print("-" * 10, '字典合并运算', "-" * 10)
d1 = {'a': 10, 'b': 20, 'c': 30}
d2 = {'d': 40, 'e': 50, 'f': 60}
zipDict = zip(d1, d2)
print(dict(zipDict))
maredDict = d1 | d2
print(maredDict)

print("-" * 10, '同步迭代', "-" * 10)
# 集合是无序的,需要注意不要一下
# fruits = {'apple', 'banana', 'cherry'}
fruits = ['apple', 'banana', 'cherry']
counts = [10, 20, 30]
print(dict(zip(counts, fruits)))
for key, value in zip(fruits, counts):
    match key, value:
        case 'apple', 10:
            print(10, "个苹果")
        case 'banana', 20:
            print(20, '跟香蕉')
        case 'cherry', 30:
            print(30, '个🍒')
